import request from '@/utils/request'

/** *
 *
 * 获取班级列表信息
 * **/
export function getClass(params) {
    return request({
        url: '/admin/class/class',
        params
    })
}
/** *
 *
 * 编辑班级回显
 * **/
export function EditShowClass(id) {
    return request({
        url: `/admin/class/class/${id}`,
    })
}
/** *
 *
 * 渲染下拉菜单学科数据回显
 * **/
export function subjectClass() {
    return request({
        url: '/admin/subject/tree',
    })
}
/** *
 *
 * 渲染下拉菜单老师数据回显
 * **/
export function teacherClass(name) {
    return request({
        url: `/admin/class/teacher?role_name=${name}`,
        name
    })
}
/** *
 *
 * 状态改变
 * **/
export function changeState(row) {
    return request({
        url: `/admin/class/class/${row.id}`,
        method: 'PUT',
        data: {
            id: row.id,
            state: row.state == 1 ? 2 : 1
        }
    })
}
/** *
 *
 * 删除班级信息
 * **/
export function delClass(id) {
    return request({
        url: `/admin/class/class/${id}`,
        method: 'DELETE'
    })
}
/** *
 *
 * 编辑班级信息
 * **/
export function editClass(data) {
    return request({
        url: `/admin/class/class/${data.id}`,
        method: 'PUT',
        data
    })
}
/** *
 *
 * 添加班级
 * **/
export function addClass(data) {
    return request({
        url: '/admin/class/class',
        method: 'POST',
        data
    })
}